package T01_test_all.test15_stringTest;

import java.util.Scanner;

public class T02_luoma {
    public static void main(String[] args) {
        String str;
        while (true) {
            Scanner sc = new Scanner(System.in);
            str = sc.next();
            boolean bl = getIsNumber(str);
            if(bl){
                break;
            }else {
                System.out.println("请输入正确的数值");
                continue;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            String ss = getLuoMa(ch - 48);
            sb.append(ss).append(",");

        }
        System.out.println(sb);
    }

    /**
     * 罗马数字回显
     * @param str
     * @return
     */
    public static String getLuoMa(int str){
        String[] LuoMa = { "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X",};
        return LuoMa[str];
    }

    /***
     * 判断是否为规定 数字组合
     * @param arr
     * @return
     */
    public static Boolean getIsNumber(String arr){
        if(arr.length() > 9){
            return false;
        }
        for (int i = 0; i < arr.length(); i++) {
            char c = arr.charAt(i);
            if(c < '0' || c > '9'){
                return false;
            }
        }
        return true;
    }
}
